package com.iphanta.community.following.mapper;

import com.iphanta.community.following.entity.Dynamic;
import com.iphanta.community.following.traffic.admin.vo.AdminDynamicItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 墨声 E-mail: zehong.hongframe.huang@gmail.com
 * create time: 2/15/22 11:45 AM
 */
@Mapper
public interface DynamicMapper {

    int insert(Dynamic dynamic);

    Dynamic selectById(@Param("id") Long id);

    List<Dynamic> selectByUid(@Param("uid") String uid, @Param("cursor") Long cursor);

    List<Dynamic> selectByIds(String followerId, List<Long> ids);

    List<Dynamic> selectNewlyDynamicsByFollowerId(String followerId);

    Integer batchUpdateLikedCount(List<Dynamic> dynamics);

    Integer updateCommentCount(Long dynamicId);

    Integer batchUpdateDynamic(List<Dynamic> dynamics);

    Integer deleteDynamic(Long id);

    List<Dynamic> likeCountgreaterThan20();

    List<Dynamic> select(String followerId, Long cursor);

    List<Dynamic> selectInIdIgnoreDel(List<Long> ids);

    Long sumLikedCount(@Param("uid") String uid);

    Integer liked(String uid, Long dynamicId);

    List<AdminDynamicItem> list(@Param("nickname") String nickname,
                                @Param("content") String content,
                                @Param("start") String start,
                                @Param("stop") String stop,
                                @Param("timeRange") Boolean timeRange);

    Integer modifyTags(@Param("dynamicId") Long dynamicId,
                       @Param("codes") String codes);

}
